home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98a.txt / 000110_icon-group-sender _Mon Mar 9 15:45:01 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.8.7/8.8.7) with SMTP id PAA08142
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 9 Mar 1998 15:44:57 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA12327; Mon, 9 Mar 1998 15:44:57 -0700
  7. Date: Mon, 9 Mar 1998 17:11:55 -0600
  8. Message-Id: <199803092311.RAA19535@segfault.cs.utsa.edu>
  9. From: Clinton Jeffery <jeffery@segfault.cs.utsa.edu>
  10. To: icon-group@optima.CS.Arizona.EDU
  11. In-Reply-To: <35043AF2.20D5@gte.net> (message from Mark Evans on Mon, 09 Mar
  12.     1998 12:54:42 -0600)
  13. Subject: Re: Stripping don't-cares
  14. Reply-To: jeffery@cs.utsa.edu
  15. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  16. Status: RO
  17. Content-Length: 895
  18.  
  19.  
  20. > Mark Evans asked:
  21. >   Briefly, what is the optimum method of stripping don't-care characters
  22. >   from each line of input?  ...map() can replace characters, but I want
  23. >   them to just go away.
  24.  
  25. Mark,
  26.  
  27. There is a trim() function that trims dont_care's off the end of a string,
  28. but to trim stuff in the middle of the string you need to actually walk
  29. through the string one way or another.
  30.  
  31. The sleaziest way I know would be something like:
  32.  
  33.     while line[upto(dont_care,line)] := ""
  34.  
  35. a sneaky refinement is
  36.  
  37.     x := 1
  38.     while line[x := upto(dont_care, line, x)] := ""
  39.  
  40. If you have to do this for large files and are concerned about efficiency,
  41. there may be more efficient ways to do it.  I bet icon-group can come up
  42. with 8 different solutions with varying performance.  I didn't check these
  43. solutions for off-by-one errors; I guess you can do that for me.  :-)
  44.  
  45. Clint Jeffery, jeffery@cs.utsa.edu
  46.